//
//  RNBusinessInfo.m
//  ModifyMetroDemo
//
//  Created by Marcus on 2020/3/9.
//  Copyright © 2020 Facebook. All rights reserved.
//

#import "RNBusinessInfo.h"

@implementation RNBusinessInfo

- (instancetype)init
{
  // 1. 加载父类资源
  if (self = [super init]) {
    // 初始化对象
    // 2.加载自己的资源
    _displayName = @"";
    _orgBundleFilePath =  @"";
    _diffBundleFilePath = @"";
    _mainComponentName = @"";
  }
  
  // 3. 资源加载完成返回
  return self;
}

- (instancetype)initWithDisplayName:(NSString*)dispaly
                  orgBundleFilePath: (NSString*) orgPath
                 diffBundleFilePath: (NSString*) diffPath
                  mainComponentName: (NSString*) mainName
{
  if (self = [super init]) {
    _displayName = dispaly;
    _orgBundleFilePath =  orgPath;
    _diffBundleFilePath = diffPath;
    _mainComponentName = mainName;
  }
  return self;
}

//自定义对象转换NSData
- (void)encodeWithCoder:(NSCoder *)aCoder{
  [aCoder encodeObject:self.displayName forKey:@"displayName"];
  [aCoder encodeObject:self.orgBundleFilePath forKey:@"orgBundleFilePath"];
  [aCoder encodeObject:self.diffBundleFilePath forKey:@"diffBundleFilePath"];
  [aCoder encodeObject:self.mainComponentName forKey:@"mainComponentName"];
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder{
  
  if (self = [super init]) {
    self.displayName = [aDecoder decodeObjectForKey:@"displayName"];
    self.orgBundleFilePath = [aDecoder decodeObjectForKey:@"orgBundleFilePath"];
    self.diffBundleFilePath = [aDecoder decodeObjectForKey:@"diffBundleFilePath"];
    self.mainComponentName = [aDecoder decodeObjectForKey:@"mainComponentName"];
  }
  return self;
}

@end
